#ifndef _xNodeType_existing_H_
#define	_xNodeType_existing_H_

#include "xNodeType.h"

class xInMappingPort ;
class xNodeType_existing : public xNodeType {

protected: 
	DIVA_VM *	_vm ;
	vmdescriptor* _vd ;
	int			_id ;
	string		_idname ;
	static string valid_rhs_pair[][2] ;
	string _stringbuffer[40] ;
public:
	xNodeType_existing(DIVA_VM * vm) { _vm = vm ; }

	// inherited methods
	virtual void		setupPorts() ;
	virtual string		getType() { return "existing" ; }
	virtual void		createMappedObject() ;
	virtual xParameter  toXParameter(string toType, xOutMappingPort *linkedop); 
	virtual bool		update();
	virtual string		toMDString(MDSType) ;
	virtual int     parseMDString(vector<string>& tokens, int start_index);
	virtual bool verify_rhs_link(xOutMappingPort *left, xInMappingPort *right, xNodeType* rightnode);
	virtual bool verify_lhs_link(xOutMappingPort *left, xNodeType* leftnode, xInMappingPort *right);
	// privately own methods
	virtual void attach(DIVA_VM *vm) { _vm = vm ; }
	virtual DIVA_VM*  getVM() { return _vm ; }
	inline void setID(int id) { _id =  id ; }
	inline int getID() { return _id ; }
	vmdescriptor* get_vmdescriptor() { return _vd ; }
	xNodeType * toNodeTypeByLink(xInMappingPort *inp) ;
};

#endif
